#include "mainwindow.h"
#include <QApplication>
//#include"canlib.h"
#include <QDebug>  			//qDebug()需要的头文件
//addtoolBar 头文件
#include <QToolBar>
#include <QAction>
//addmessageBox头文件
#include <QMessageBox>
#include"Worker.h"
// // When called, CheckForError will check for and print any error.
// // The program is aborted if an error has occured.
// void CheckForError(char cmd[50], canStatus stat)
// {
//     //if stat not ok, print error
//     if (stat != canOK)
//     {
//         char buf[255];
//         buf[0] = '\0';
//         canGetErrorText(stat, buf, sizeof(buf));
//         qDebug()<<"["<< cmd<<"]"<<buf<<": falied,stat="<<int(stat);
//         qDebug()<<"ABORT (Press any key)";
//         getchar();
//         abort();
//     }
// }
// // ListChannels prints a list of all connected CAN interfaces.
// void ListChannels()
// {
//     canStatus stat;
//     int number_of_channels;
//     int device_channel;
//     char device_name[255];
//     // Get number of channels
//     stat = canGetNumberOfChannels(&number_of_channels);
//     CheckForError((char*)"canGetNumberOfChannels", stat);
//     if (number_of_channels > 0) {
//         qDebug()<<"Found "<<number_of_channels<<"channels";
//     }
//     else {
//         qDebug()<<"Could not find any CAN interface.";
//     }
//     // Loop and print all channels
//     for (int i = 0; i < number_of_channels; i++) {
//         stat = canGetChannelData(i, canCHANNELDATA_DEVDESCR_ASCII, device_name, sizeof(device_name));
//         CheckForError((char*)"canGetChannelData", stat);
//         stat = canGetChannelData(i, canCHANNELDATA_CHAN_NO_ON_CARD, &device_channel, sizeof(device_channel));
//         CheckForError((char*)"canGetChannelData", stat);
//         qDebug()<<"Found Channel:>>>>"<<i<<"\t"<<device_name<<"\t"<<(device_channel);
//     }
// }
int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.showMaximized();
    //canStatus stat;
   // canInitializeLibrary();
    qDebug()<<"CanlibTutorial started.....";
    //ListChannels();








    return a.exec();
}
